<?php
class ParamHeader extends CActiveRecord {
	/**
	 * The followings are the available columns in table 'param_header':
	 * @var integer $header_id
	 * @var string $header_mnemonic
	 * @var string $header_label
	 * @var integer $column_index
	 * @var string $column_type
	 * @var string $column_constraint
	 * @var integer $param_id
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className= __CLASS__) {
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName() {
		return 'param_header';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules() {
		return array (
			array (
				'header_mnemonic',
				'length',
				'max' => 10
			),
			array (
				'header_label',
				'length',
				'max' => 100
			),
			array (
				'header_mnemonic, header_label, column_index, column_type',
				'required'
			),
			array (
				'column_index',
				'numerical',
				'integerOnly' => true
			)
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations() {
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array (
			'param' => array (
				self::BELONGS_TO,
				'ParamDesc',
				'param_id'
			)
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels() {
		return array (
			'header_id' => 'Header',
			'header_mnemonic' => 'Header Mnemonic',
			'header_label' => 'Header Label',
			'column_index' => 'Column Index',
			'column_type' => 'Column Type',
			'column_constraint' => 'Column Constraint',
			'param_id' => 'Param'
		);
	}

	private static $_db;

	public function getDbConnection() {
		return self::$_db;
	}

	public function setDbConnection($db) {
		self::$_db= $db;
	}

}
?>